<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>粘性布局</title>
  <style>
    html,
    body {
      height: 100%;
      margin: 0;
    }

    .wrapper {
      min-height: 100%;
      margin-bottom: -50px;
    }

    .content {
      padding: 20px;
    }

    .footer,
    .push {
      height: 50px;
    }

    .footer {
      background-color: #333;
      color: white;
      text-align: center;
      line-height: 50px;
    }
  </style>
</head>

<body>
  <div class="wrapper">
    <div class="content">
      <p>页面内容</p>
    </div>
    <div class="push"></div>
  </div>
  <div class="footer">底部</div>
</body>

</html>